package java核心技术卷一;

import java.io.Console;

class Solution {
    public static void main(String[] args) {
        String hello = "hello";
        String world = "world";

        String helloworld = hello+world;
        System.out.println(helloworld); //helloworld
        String string = helloworld.substring(0,3); //[0,3)
        System.out.println(string); //hel

        
        System.out.println(helloworld.charAt(0)); //h
        System.out.println(helloworld.codePointAt(0)); //104
        System.out.println(helloworld.offsetByCodePoints(1, 3)); //4
        System.out.println(helloworld.compareTo(helloworld)); //0
        System.out.println(helloworld.endsWith("world")); //true
        System.out.println(helloworld.equals("helloworld")); //true
        System.out.println(helloworld.equalsIgnoreCase("HelloWorld")); //true
        System.out.println(helloworld.indexOf("hello")); //0
        System.out.println(helloworld.lastIndexOf("l")); //8
        System.out.println(helloworld.length());
        System.out.println(helloworld.codePointCount(0, 3));
        System.out.println(helloworld.replace(helloworld, string));
        System.out.println(helloworld.startsWith("hello"));
        System.out.println(helloworld.substring(0,3));
        System.out.println(helloworld.toLowerCase());
        System.out.println(helloworld.toUpperCase());
        System.out.println(helloworld.trim()); //删除头部和尾部空格


        System.out.println("---------------------------------");

        StringBuilder builder = new StringBuilder();
        builder.append(hello);
        builder.append(world);
        string = builder.toString();
        System.out.println(string);

        System.out.println("---------------------------------");

        Console cons = System.console();
        String username = cons.readLine("User name: ");
        char[] passwd = cons.readPassword("Password: ");
        
    }
}